# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2023年03月13日
"""
import openpyxl

myBook=openpyxl.load_workbook('录取表.xlsx')
mySheet=myBook['录取表']

myRange=list(mySheet.values)
myDict={}
for myRow in myRange[3:]:
	if myRow[0] in myDict.keys() and myRow[1] in myDict[myRow[0]].keys():
		myDict[myRow[0]][myRow[1]]+=[myRow]
	else:
		if myRow[0] not in myDict.keys():myDict[myRow[0]]={}
		myDict[myRow[0]][myRow[1]]=[myRow]

for myKey,myValue in myDict.items():
	myNewBook=openpyxl.Workbook()
	for myKey2,myValue2 in myValue.items():
		myNewSheet=myNewBook.create_sheet(myKey2+'专业录取表')
		myNewSheet.append(myRange[2])
		for myRow in myValue2:
			myNewSheet.append(myRow)
	myNewBook.remove(myNewBook['Sheet'])
	myPath='结果表'+myKey+'录取表.xlsx'
	myNewBook.save(myPath)

